data.cor <- cor(county.Demo_and_Covid.allcounties[,-1], use = "complete.obs", method = "spearman")
corrplot.mixed(data.cor, upper = 'ellipse', lower = 'number', tl.pos = 'lt', tl.cex = 1, lower.col = "black", number.cex = 0.5)
data.cor2 <- cor(county.Demo_and_Covid.500counties[,-c(1:2)], use = "complete.obs", method = "spearman")
corrplot.mixed(data.cor2, upper = 'ellipse', lower = 'number', tl.pos = 'lt', tl.cex = 1, lower.col = "black", number.cex = 0.5)
corrplot.mixed(data.cor2[7:13,c(1:5, 14:42,6)], upper = 'ellipse', tl.pos = 'lt', tl.cex = 1, lower.col = "black", number.cex = 0.5)
this.lme <- lmer("total.cases.percap ~ Affluence + Singletons.in.Tract + Seniors.in.Tract + African.Americans.in.Tract + Noncitizens.in.Tract + High.BP + Binge.Drinking + Cancer + Asthma + Heart.Disease + COPD + Smoking + Diabetes + No.Physical.Activity + Obesity + Poor.Sleeping.Habits + Poor.Mental.Health + Testing_Rate + Hospitalization_Rate + (1 | stateID)", data = county.Demo_and_Covid.500counties)
## Warning: Some predictor variables are on very different scales: consider
## rescaling
## Warning: Some predictor variables are on very different scales: consider
## rescaling
print(summary(this.lme), correlation=TRUE)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula:
## "total.cases.percap ~ Affluence + Singletons.in.Tract + Seniors.in.Tract + African.Americans.in.Tract + Noncitizens.in.Tract + High.BP + Binge.Drinking + Cancer + Asthma + Heart.Disease + COPD + Smoking + Diabetes + No.Physical.Activity + Obesity + Poor.Sleeping.Habits + Poor.Mental.Health + Testing_Rate + Hospitalization_Rate + (1 | stateID)"
## Data: county.Demo_and_Covid.500counties
##
## REML criterion at convergence: -1189.2
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -2.9747 -0.3562 -0.0937 0.1800 5.5856
##
## Random effects:
## Groups Name Variance Std.Dev.
## stateID (Intercept) 0.000001378 0.001174
## Residual 0.000014342 0.003787
## Number of obs: 178, groups: stateID, 33
##
## Fixed effects:
## Estimate Std. Error df
## (Intercept) -0.0104117203 0.0098432057 68.8282759388
## Affluence 0.0048274431 0.0011309123 99.1979648622
## Singletons.in.Tract 0.0014866677 0.0009340002 139.6332119796
## Seniors.in.Tract 0.0009346562 0.0012289519 149.4996429189
## African.Americans.in.Tract 0.0006462671 0.0010311797 151.4729127508
## Noncitizens.in.Tract 0.0009516998 0.0007940877 124.7855041345
## High.BP 0.0001913624 0.0001937876 107.6902419495
## Binge.Drinking 0.0001619004 0.0001617185 41.9215247865
## Cancer -0.0009864808 0.0011305537 99.6552434308
## Asthma 0.0006856561 0.0005711476 40.5575488973
## Heart.Disease 0.0011807170 0.0013408495 72.1646517163
## COPD -0.0001521381 0.0011122050 75.3294730652
## Smoking -0.0000977564 0.0002324652 78.4332543214
## Diabetes -0.0005905303 0.0005481730 78.9237172176
## No.Physical.Activity -0.0000217046 0.0002104448 88.2761580675
## Obesity 0.0002522799 0.0001816996 96.9451317512
## Poor.Sleeping.Habits -0.0000040978 0.0001694813 122.6925612117
## Poor.Mental.Health -0.0000681915 0.0004266173 30.7879875558
## Testing_Rate 0.0000005219 0.0000002714 33.8357903501
## Hospitalization_Rate -0.0001100855 0.0000925599 27.6921970680
## t value Pr(>|t|)
## (Intercept) -1.058 0.294
## Affluence 4.269 0.0000451 ***
## Singletons.in.Tract 1.592 0.114
## Seniors.in.Tract 0.761 0.448
## African.Americans.in.Tract 0.627 0.532
## Noncitizens.in.Tract 1.198 0.233
## High.BP 0.987 0.326
## Binge.Drinking 1.001 0.323
## Cancer -0.873 0.385
## Asthma 1.200 0.237
## Heart.Disease 0.881 0.381
## COPD -0.137 0.892
## Smoking -0.421 0.675
## Diabetes -1.077 0.285
## No.Physical.Activity -0.103 0.918
## Obesity 1.388 0.168
## Poor.Sleeping.Habits -0.024 0.981
## Poor.Mental.Health -0.160 0.874
## Testing_Rate 1.923 0.063 .
## Hospitalization_Rate -1.189 0.244
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation of fixed effects could have been required in summary()
##
## Correlation of Fixed Effects:
## (Intr) Afflnc Sng..T Snr..T A.A..T Nnc..T Hgh.BP Bng.Dr Cancer
## Affluence 0.135
## Sngltns.n.T 0.021 0.073
## Snrs.n.Trct 0.571 0.377 0.192
## Afrcn.Am..T 0.158 0.150 -0.409 0.141
## Nnctzns.n.T 0.000 0.100 0.041 0.065 -0.079
## High.BP -0.006 0.239 0.063 0.110 -0.095 0.396
## Bing.Drnkng -0.279 -0.195 -0.297 -0.185 0.078 0.038 0.133
## Cancer -0.588 -0.199 0.180 -0.330 -0.074 -0.145 -0.379 -0.115
## Asthma -0.370 -0.213 -0.239 -0.193 0.088 0.091 0.170 -0.010 0.046
## Heart.Dises -0.150 0.077 -0.290 -0.153 0.248 -0.105 -0.012 0.057 -0.470
## COPD 0.566 0.040 0.138 0.284 -0.007 0.286 0.179 0.114 -0.272
## Smoking -0.175 0.145 -0.169 -0.104 -0.059 0.003 -0.068 -0.297 0.093
## Diabetes 0.075 -0.336 -0.104 -0.222 -0.308 -0.323 -0.525 0.049 0.242
## N.Physcl.Ac -0.178 -0.058 0.076 -0.040 -0.035 -0.225 -0.113 0.100 0.478
## Obesity 0.004 0.427 0.422 0.303 0.143 0.198 -0.088 -0.237 0.110
## Pr.Slpng.Hb -0.453 -0.405 0.143 -0.361 -0.358 -0.021 -0.189 0.092 0.140
## Pr.Mntl.Hlt -0.334 0.257 -0.063 -0.070 0.100 -0.182 -0.077 0.060 0.314
## Testing_Rat 0.173 -0.065 -0.018 0.032 0.044 -0.083 -0.014 0.019 -0.176
## Hsptlztn_Rt -0.155 -0.206 -0.112 -0.224 -0.050 -0.113 -0.120 -0.136 0.058
## Asthma Hrt.Ds COPD Smokng Diabts N.Ph.A Obesty Pr.S.H Pr.M.H
## Affluence
## Sngltns.n.T
## Snrs.n.Trct
## Afrcn.Am..T
## Nnctzns.n.T
## High.BP
## Bing.Drnkng
## Cancer
## Asthma
## Heart.Dises 0.280
## COPD -0.380 -0.562
## Smoking 0.086 0.206 -0.518
## Diabetes -0.120 -0.291 -0.106 0.233
## N.Physcl.Ac 0.010 -0.382 -0.011 -0.324 -0.060
## Obesity -0.275 -0.095 0.165 -0.200 -0.392 -0.065
## Pr.Slpng.Hb 0.066 0.250 -0.201 0.005 -0.011 -0.117 -0.167
## Pr.Mntl.Hlt -0.241 0.087 -0.445 0.089 0.028 0.050 0.094 -0.188
## Testing_Rat -0.353 -0.039 0.193 0.133 0.109 -0.302 0.109 -0.108 -0.086
## Hsptlztn_Rt 0.080 0.093 -0.128 0.090 0.072 -0.026 -0.036 0.003 -0.040
## Tstn_R
## Affluence
## Sngltns.n.T
## Snrs.n.Trct
## Afrcn.Am..T
## Nnctzns.n.T
## High.BP
## Bing.Drnkng
## Cancer
## Asthma
## Heart.Dises
## COPD
## Smoking
## Diabetes
## N.Physcl.Ac
## Obesity
## Pr.Slpng.Hb
## Pr.Mntl.Hlt
## Testing_Rat
## Hsptlztn_Rt 0.190
## fit warnings:
## Some predictor variables are on very different scales: consider rescaling
this.lme <- lmer("total.cases.percap ~ Affluence + Singletons.in.Tract + Seniors.in.Tract + African.Americans.in.Tract + Noncitizens.in.Tract + High.BP + Binge.Drinking + Cancer + Asthma + Heart.Disease + COPD + Smoking + Diabetes + No.Physical.Activity + Obesity + Poor.Sleeping.Habits + Poor.Mental.Health + (1 | stateID)", data = county.Demo_and_Covid.500counties)
print(summary(this.lme), correlation=TRUE)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula:
## "total.cases.percap ~ Affluence + Singletons.in.Tract + Seniors.in.Tract + African.Americans.in.Tract + Noncitizens.in.Tract + High.BP + Binge.Drinking + Cancer + Asthma + Heart.Disease + COPD + Smoking + Diabetes + No.Physical.Activity + Obesity + Poor.Sleeping.Habits + Poor.Mental.Health + (1 | stateID)"
## Data: county.Demo_and_Covid.500counties
##
## REML criterion at convergence: -2477.5
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -3.7177 -0.3398 -0.0885 0.2272 6.5945
##
## Random effects:
## Groups Name Variance Std.Dev.
## stateID (Intercept) 0.000006569 0.002563
## Residual 0.000011304 0.003362
## Number of obs: 326, groups: stateID, 51
##
## Fixed effects:
## Estimate Std. Error df t value
## (Intercept) -0.01972520 0.00751320 190.37930648 -2.625
## Affluence 0.00279058 0.00068406 301.56986210 4.079
## Singletons.in.Tract 0.00118468 0.00063955 301.46059112 1.852
## Seniors.in.Tract 0.00064501 0.00080763 304.73321981 0.799
## African.Americans.in.Tract 0.00143834 0.00078051 306.98596092 1.843
## Noncitizens.in.Tract 0.00159725 0.00062846 269.63362561 2.542
## High.BP -0.00003444 0.00014113 297.63541521 -0.244
## Binge.Drinking 0.00036333 0.00014778 155.93263523 2.459
## Cancer -0.00035104 0.00082698 264.19602838 -0.424
## Asthma 0.00049824 0.00048958 138.91100871 1.018
## Heart.Disease 0.00287246 0.00105962 207.16002099 2.711
## COPD -0.00113448 0.00080204 201.92101740 -1.414
## Smoking -0.00023756 0.00018559 247.58463762 -1.280
## Diabetes -0.00099714 0.00039791 266.75680391 -2.506
## No.Physical.Activity 0.00025557 0.00015971 234.55514903 1.600
## Obesity 0.00021835 0.00012965 307.99766654 1.684
## Poor.Sleeping.Habits 0.00027737 0.00012472 296.48269662 2.224
## Poor.Mental.Health -0.00012057 0.00041478 101.67913458 -0.291
## Pr(>|t|)
## (Intercept) 0.00936 **
## Affluence 0.0000578 ***
## Singletons.in.Tract 0.06495 .
## Seniors.in.Tract 0.42512
## African.Americans.in.Tract 0.06632 .
## Noncitizens.in.Tract 0.01160 *
## High.BP 0.80737
## Binge.Drinking 0.01504 *
## Cancer 0.67156
## Asthma 0.31059
## Heart.Disease 0.00727 **
## COPD 0.15876
## Smoking 0.20174
## Diabetes 0.01281 *
## No.Physical.Activity 0.11091
## Obesity 0.09318 .
## Poor.Sleeping.Habits 0.02691 *
## Poor.Mental.Health 0.77188
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation of fixed effects could have been required in summary()
##
## Correlation of Fixed Effects:
## (Intr) Afflnc Sng..T Snr..T A.A..T Nnc..T Hgh.BP Bng.Dr Cancer
## Affluence -0.047
## Sngltns.n.T -0.057 0.044
## Snrs.n.Trct 0.398 0.293 0.074
## Afrcn.Am..T 0.242 0.076 -0.405 0.202
## Nnctzns.n.T -0.072 0.153 0.126 0.057 -0.189
## High.BP -0.096 0.157 0.099 0.007 -0.235 0.329
## Bing.Drnkng -0.486 -0.043 -0.206 -0.070 0.042 -0.076 0.149
## Cancer -0.496 -0.096 0.231 -0.174 -0.073 -0.068 -0.329 -0.021
## Asthma -0.267 -0.098 -0.262 -0.120 -0.012 0.210 0.054 0.007 -0.158
## Heart.Dises -0.057 0.076 -0.300 -0.132 0.212 -0.054 -0.002 0.034 -0.602
## COPD 0.479 0.012 0.127 0.173 -0.004 0.156 0.059 0.061 -0.213
## Smoking -0.045 0.105 -0.119 -0.137 -0.105 0.160 -0.083 -0.327 0.158
## Diabetes 0.036 -0.300 -0.079 -0.133 -0.230 -0.255 -0.445 0.075 0.365
## N.Physcl.Ac -0.115 0.033 0.101 0.079 0.060 -0.274 0.004 0.124 0.338
## Obesity -0.065 0.384 0.398 0.203 0.133 0.194 -0.103 -0.149 0.119
## Pr.Slpng.Hb -0.386 -0.352 0.163 -0.327 -0.322 -0.046 -0.156 0.087 0.029
## Pr.Mntl.Hlt -0.354 0.183 -0.007 0.019 0.050 -0.166 0.026 0.131 0.417
## Asthma Hrt.Ds COPD Smokng Diabts N.Ph.A Obesty Pr.S.H
## Affluence
## Sngltns.n.T
## Snrs.n.Trct
## Afrcn.Am..T
## Nnctzns.n.T
## High.BP
## Bing.Drnkng
## Cancer
## Asthma
## Heart.Dises 0.336
## COPD -0.323 -0.490
## Smoking 0.144 0.082 -0.476
## Diabetes -0.106 -0.430 -0.010 0.278
## N.Physcl.Ac -0.024 -0.361 0.087 -0.274 -0.169
## Obesity -0.128 -0.021 0.092 -0.220 -0.377 -0.045
## Pr.Slpng.Hb 0.000 0.240 -0.094 -0.166 -0.060 -0.154 -0.115
## Pr.Mntl.Hlt -0.436 -0.067 -0.388 -0.027 0.072 -0.083 0.027 -0.082
testing.data.state <- compiled.stats[[length(daily_filenames)]][, c("Province_State", "Testing_Rate")]
testing.data.state <- testing.data.state[!is.na(testing.data.state$Testing_Rate),]
testing.data.state <- testing.data.state[order(testing.data.state$Testing_Rate),]
col.state <- rep("pink", nrow(testing.data.state))
avg.test.rate <- mean(testing.data.state$Testing_Rate, na.rm = T)
col.state[testing.data.state$Testing_Rate < avg.test.rate] <- "grey"
col.state[testing.data.state$Province_State == "Oklahoma"] <- "lightblue"
par(mar = c(5,6,4,2))
barplot(testing.data.state$Testing_Rate, names.arg = testing.data.state$Province_State, horiz = T, main = "Testing Rate by State", las = 2, cex.axis = 1, cex.names = 0.5, col = col.state, border = F, xlab = "Total number of people tested per 100,000 persons.")
abline(v = avg.test.rate, col = "red")
text(x = avg.test.rate + 10, y = 1, labels = "Average Testing Rate", adj = c(0, 0.5), col = "red")
Pink highlights the last 14 days.
day.first.case <- min(which(US.total$cases.total > 100))
n.days <- nrow(US.total)
twoweek.col <- c(rep("grey", n.days-day.first.case-13), rep("pink", 14))
par(mar = c(5,5,4,2))
barplot(US.total$cases.total[day.first.case:n.days],
names = US.total$day[day.first.case:n.days],
main = "Total COVID-19 cases by Date in US",
las = 2, cex.axis = 1, cex.names = 0.5,
col = twoweek.col, border = F)
barplot(US.total$cases.total[day.first.case:n.days],
names = US.total$day[day.first.case:n.days],
main = "Total COVID-19 cases by Date in US, log scale",
las = 2, cex.axis = 1, cex.names = 0.5, log = "y",
col = twoweek.col, border = F)
barplot(US.total$deaths.total[day.first.case:n.days],
names = US.total$day[day.first.case:n.days],
main = "Total COVID-19 deaths by Date in US",
las = 2, cex.axis = 1, cex.names = 0.5,
col = twoweek.col, border = F)
barplot(US.total$deaths.total[day.first.case:n.days],
names = US.total$day[day.first.case:n.days],
main = "Total COVID-19 deaths by Date in US, log scale",
las = 2, cex.axis = 1, cex.names = 0.5, log = "y",
col = twoweek.col, border = F)
barplot(US.total$rise.cases.total[day.first.case:n.days],
names = US.total$day[day.first.case:n.days],
main = "Rise in Cases of COVID-19 by Date in US",
las = 2, cex.axis = 1, cex.names = 0.5,
col = twoweek.col, border = F)
barplot(US.total$rise.deaths.total[day.first.case:n.days],
names = US.total$day[day.first.case:n.days],
main = "Rise in Deaths of COVID-19 by Date in US",
las = 2, cex.axis = 1, cex.names = 0.5,
col = twoweek.col, border = F)